from sklearn.datasets import load_wine
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC


def main():
    wine = load_wine()
    x_train, x_test, y_train, y_test = train_test_split(
        wine.data, wine.target)

    # kernel = {'precomputed', 'sigmoid', 'rbf', 'poly', 'linear'}
    # linear线性核函数 poly多项式核函数 rbf高斯/径向基核函数 sigmoid核函数 precomputed提前计算好核函数矩阵
    model = SVC(kernel='linear')
    model.fit(x_train, y_train)

    train_score = model.score(x_train, y_train)
    test_score = model.score(x_test, y_test)

    print("train score:", train_score)
    print(" test score:", test_score)


if __name__ == '__main__':
    main()
